define([ 'jquery' ], function($) {

	$.put = function(url) {
		return $.ajax({
			url : url,
			type : 'PUT'
		}).error(function(jqXHR, textStatus, errorThrown) {
			console.log(jqXHR);
		});
	};

		
	$.get = function(url) {
		return $.ajax({
			url : url,
			type : 'GET'
		}).error(function(jqXHR, textStatus, errorThrown) {
			console.log('error url:', url, jqXHR);
		});
	};

	$.post = function(url) {
		return $.ajax({
			url : url,
			type : 'POST'
		}).error(function(jqXHR, textStatus, errorThrown) {
			console.log('error url:', url, jqXHR);
		});
	};

	$.fn.center = function(root) {
		this.css("position", "absolute");
		this.css("top", Math.max(0, (($(root).height() - this.outerHeight()) / 2) + $(window).scrollTop()) + "px");
		this.css("left", Math.max(0, (($(root).width() - this.outerWidth()) / 2) + $(window).scrollLeft()) + "px");
		return this;
	};

	String.prototype.format = function() {
		var s = this, i = arguments.length;

		while (i--) {
			s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
		}
		return s;
	};

	Array.prototype.last = function() {
		return this[this.length - 1];
	};

	Array.prototype.contains = function(obj) {
		var i = this.length;
		while (i--) {
			if (this[i] === obj) {
				return true;
			}
		}
		return false;
	};

	return $;
});